/*
 * @Author: myw
 * @Email: 516378746@qq.com
 * @Date: 2020-02-24 08:49:18
 * @Descripttion: 
 */
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from "./login/login.component";
import { LayoutComponent } from "./h-common/layout/layout.component";
import { HomeComponent } from "./home/home.component"

const routes: Routes = [
    {
        path : "login",
        component : LoginComponent,
        data : {
            title : "登录",
        }
    },
    {
        path : "",
        redirectTo : "home",
        pathMatch : "full"
    },
    {
        path : "",
        component : LayoutComponent,
        children : [
            {
                path : "home",
                data : {
                    title : "首页",
                    uid : 1,
                    isLastLevel : true
                },
                component : HomeComponent
            },
            {
                path: "system",
                data : {
                    title : "系统管理",
                    uid : 2,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./system-manage/system-manage.module").then((mod) => {
                        return mod.SystemManageModule
                    })
                }
            },
            {
                path: "material",
                data : {
                    title : "物料管理",
                    uid : 3,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./material-manage/material-manage.module").then((mod) => {
                        return mod.MateriralManageModule
                    })
                }
            },
            {
                path: "quality",
                data : {
                    title : "质量管理",
                    uid : 4,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./quality-manage/quality-manage.module").then((mod) => {
                        return mod.QualityManageModule
                    })
                }
            },
            {
                path: "news",
                data : {
                    title : "消息管理",
                    uid : 5,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./news-manage/news-manage.module").then((mod) => {
                        return mod.NewsManageModule
                    })
                }
            },
            {
                path: "version",
                data : {
                    title : "版本管理",
                    uid : 6,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./version-manage/version-manage.module").then((mod) => {
                        return mod.VersionManageModule
                    })
                }
            },
            {
                path: "waittasks",
                data : {
                    title : "待办任务管理",
                    uid : 7,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./wait-manage/wait-manage.module").then((mod) => {
                        return mod.WaitManageModule
                    })
                }
            },
            {
                path: "center",
                data : {
                    title : "个人中心",
                    uid : 8,
                    isLastLevel : false
                },
                loadChildren: () => {
                    return import("./center-manage/center-manage.module").then((mod) => {
                        return mod.CenterManageModule
                    })
                }
            }
        ]
    },
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule { }
